import requests


# 去除warning
requests.packages.urllib3.disable_warnings()


url = "https://testpassport.rabbitpre.com/api/sso/login"
data = {
    "account": "15179243381",
    "password": "123456",
    "fromType": "pc"
}
session = requests.session()
response = session.post(url, json=data, verify=False)
print(response.text)

if response.json().get("errorCode") == "SUCCESS":
    print("登录成功")
else:
    print("登录失败")




user_url = "https://bws.test.rabbitpre.com/api/user"
user_info = session.get(user_url, verify=False)


orgid_url = "https://home.test.rabbitpre.com/api/workbench/org/getCompanyInfo"
orgid_info = session.get(orgid_url, verify=False)

userId = user_info.json()["data"]["userId"]
org_id = orgid_info.json()["data"]["org_id"]

print(userId)
print(org_id )